<%--
  Created by IntelliJ IDEA.
  User: hp
  Date: 2018/8/9
  Time: 18:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <script src="${pageContext.request.contextPath}/js/jquery-3.1.1.js"></script>
    <link rel="stylesheet" href="../css/style.css">
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
    <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/icon?family=Material+Icons'>
    <style type="text/css">
        #div1{
            width: 100px;
            height: 100px;

            position: absolute;
            top: 600px;
            right: 100px;
        }
        #div3{position: relative;left: 20px;top: -5px;}
        #div1-1{margin: 0 auto;position: relative;top: -85px;left: 17px;}
        #div1-2{background:red;position: relative;top: -120px;left: 20px;animation: rate 5s infinite linear;}
        #div1-2>img{position: absolute;right: 0;}
        #divNoLogin{width:200px;height: 25px; margin-bottom: 1px;line-height:25px;position: relative }
        #noLogin1{position: absolute;left: 0;top:7px;}
        #noLogin{position: absolute;left: 20px;}
        @keyframes rate{
            from{transform: rotate(0);}
            to{transform: rotate(360deg);}
        }
    </style>
</head>
<body>

<div class="cotn_principal">
    <div id="txt1">
        学生公寓管理系统
    </div>
    <div class="cont_centrar">
        <div class="cont_login">
            <div class="cont_info_log_sign_up">
                <div class="col_md_login">
                    <div class="cont_ba_opcitiy">
                        <h2>登录</h2>
                        <p>学生登录</p>
                        <button class="btn_login" onClick="cambiar_login()">登录</button>
                    </div>
                </div>
                <div class="col_md_sign_up">
                    <div class="cont_ba_opcitiy">
                        <h2>登录</h2>
                        <p>管理员登录</p>
                        <button class="btn_sign_up" onClick="cambiar_sign_up()">登录</button>
                    </div>
                </div>
            </div>
            <div class="cont_back_info">
                <div class="cont_img_back_grey"> <img src="../img/po.jpg" alt="" /> </div>
            </div>
            <div class="cont_forms" >
                <div class="cont_img_back_"> <img src="../img/po.jpg" alt="" /> </div>
                <form action="" method="post">
                    <div class="cont_form_login"> <a href="#" onClick="ocultar_login_sign_up()" ><i class="material-icons">&#xE5C4;</i></a>
                        <h2>学生登录</h2>
                        <input type="text" placeholder="User" name="no" id="stu_no"/>
                        <input type="password" placeholder="Password" id="stu_pwd" name="pwd" />
                        <%--学生登录--%>
                        <div id="divNoLogin"><input type="checkbox" id="noLogin1" name="stu_cookies" value="1"><span id="noLogin">一周免登录</span></div>
                        <button id="btn" class="btn_login" type="submit" formaction="${pageContext.request.contextPath}/StuLoginServlet">登录</button>
                        <button id="btn" class="btn_login" type="button" onclick="StubossLogin()">学生会登录</button>
                    </div>
                </form>
                <form action="" >
                    <div class="cont_form_sign_up"> <a href="#" onClick="ocultar_login_sign_up()"><i class="material-icons">&#xE5C4;</i></a>
                        <h2>管理员登录</h2>
                        <input type="text" placeholder="User" name="mgr_no" id="mno"/>
                        <input type="password" placeholder="Password" name="mgr_pwd"id="mpwd"/>
                        <button class="btn_sign_up" type="button" onclick="MgrLogin()">登录</button>
                        <button class="btn_sign_up" type="button" id="btn_reg" onClick="location.href='../MgrLogin/reg.jsp'">注册</button>

                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div id="div1">
    <a href="tencent://message/?uin=1354882033&Site=400301.com&Menu=yes">
        <div id="div3">
            <img src="../img/bg_2.png" alt="" />
        </div>
        <div id="div1-1">
            <img src="../img/bg_0.png" alt="" />
        </div>
        <div id="div1-2">
            <img src="../img/ball.png"/>
        </div></a>
</div>
<script src="../js/index.js"></script>

<script type="text/javascript">
    function MgrLogin() {
        var n=document.getElementById("mno").value;
        var m=document.getElementById("mpwd").value;

        jQuery.post("${pageContext.request.contextPath}/MgrLoginServlet.do",{"no":n,"pwd":m},function (data) {

            if(data=="true")
            {
                location.href="${pageContext.request.contextPath}/zhuServlet.do";
            }
            else{
                alert("用户名不存在或密码错误")
            }
        });

    }
    function StubossLogin() {
        var n=document.getElementById("stu_no").value;
        var m=document.getElementById("stu_pwd").value;

        jQuery.post("${pageContext.request.contextPath}/SBLoginServlet.do",{"no":n,"pwd":m},function (data) {

            if(data=="true")
            {
                location.href="${pageContext.request.contextPath}/ToMainServlet.do";
            }
            else{
                alert("用户名不存在或密码错误")
            }
        });

    }

</script>
</body>
</html>

